var express = require("express");
var app = express();  // 或者直接 var app= require("express")();
var port = 3300;
var ip = "192.168.9.101";
app.listen(port,ip);// ip 这个参数可不写，默认本地



app.get('/',function(req,res){
    res.send("Hello ERode Node.js\n");
});


//登录
app.post('/login/verify',function (req, res) {
    res.json(
    {"status":"ok","message":"ok","data":[{"img":"../image/0.jpg","flag":1,"description":"","drivinglicense":"../image/photo1.png","back":0,"travellicense":"../image/photo3.png","type":"高栏车","lastlogintime":"2017-04-28 12:54:44","capacity":18905,"operationnumber":"C420303301767","vin":"WDDFH3DB0AJ541603","emergencyperson":"茶太郎","id":2,"state":0,"height":3870,"enginenumber":"LJ465Q-1AE1","star":"5.0","locking":false,"length":11980,"vehiclephoto":"../image/photo4.png","telephone":"15605182657","emergencynumber":"15605182657","brandmodel":"解放牌CA5310CLXYP63K2","drivingnumber":"45042319870612921x","registertime":"2017-03-29 21:05:38","passwd":"666666","isowner":false,"success":0,"width":2495,"name":"茶太郎","username":"京A1234挂","operationlicense":"../image/photo2.png","status":1}]}
    );
});


//忘记密码验证
app.get('/forget/verify', function (req, res) {
    res.json(
       {"status":"ok","message":"ok","data":[{"img":"../image/0.jpg","flag":1,"description":"","drivinglicense":"../image/photo1.png","back":0,"travellicense":"../image/photo3.png","type":"高栏车","lastlogintime":"2017-04-28 12:54:44","capacity":18905,"operationnumber":"C420303301767","vin":"WDDFH3DB0AJ541603","emergencyperson":"茶太郎","id":2,"state":0,"height":3870,"enginenumber":"LJ465Q-1AE1","star":"5.0","locking":false,"length":11980,"vehiclephoto":"../image/photo4.png","telephone":"15605182657","emergencynumber":"15605182657","brandmodel":"解放牌CA5310CLXYP63K2","drivingnumber":"45042319870612921x","registertime":"2017-03-29 21:05:38","passwd":"666666","isowner":false,"success":0,"width":2495,"name":"茶太郎","username":"京A1234挂","operationlicense":"../image/photo2.png","status":1}]
    });
});


//注册司机用户1
app.get('/register/add1', function (req, res) {
    res.json(
        {"status":"ok","message":"ok","data":"8"}
    );
});


//司注册司机用户2
app.post('/register/add2', function (req, res) {
    res.json(
        {"status":"ok","message":"ok"}
    );
});


//修改司机密码
app.post('/reset/verify', function (req, res) {
    res.json(
       {"status":"ok","message":"ok"}
    );
});

//更改司机账号状态为上线
app.post('/login/alter', function (req, res) {
    res.json(
        {"status":"ok","message":"ok"}
    );
});

//更改司机账号状态为下线
app.post('/exit/alter', function (req, res) {
    res.json(
        {"status":"ok","message":"ok"}
    );
});


//修改司机车辆状态
app.post('/state/alter', function (req, res) {
    res.json({
        "status":"ok","message":"ok"
    });
});



//列出竞价中的所有订单
app.get('/package/list', function (req, res) {
    res.json(
        {"status":"ok","message":"ok","data":[{"sprovince":"辽宁省","flag":2,"cname":"周五","stime":"2017-04-28 10:00:00","edistrict":"中山区","slon":"123.440515","releasetime":"2017-04-24 20:43:12","price":950,"id":5,"scity":"沈阳市","info":"婚宴鲜花","saddr":"青年大街万象城三期LN106","elon":"121.658154","eaddr":"安阳街2号","ecity":"大连市","timelimit":4,"lefttime":3,"elat":"38.9255","sdistrict":"和平区","eprovince":"辽宁省","ctel":"15605182014","etime":"2017-04-28 17:30:00","slat":"41.783565"},{"sprovince":"吉林省","flag":2,"cname":"吴六","stime":"2017-04-28 20:15:00","edistrict":"昌邑区","slon":"125.346001","releasetime":"2017-04-25 08:12:06","price":1000,"id":6,"scity":"长春市","info":"健身器材（跑步机、训练器、杠铃等等）","saddr":"南岭街道自由大路2436号","elon":"126.532756","eaddr":"四川路4553号","ecity":"吉林市","timelimit":4,"lefttime":4,"elat":"43.881087","sdistrict":"南关区","eprovince":"吉林省","ctel":"15605182015","etime":"2017-04-29 08:00:00","slat":"43.869246"},{"sprovince":"内蒙古自治区","flag":2,"cname":"郑七","stime":"2017-04-28 09:30:00","edistrict":"东河区","slon":"111.74295","releasetime":"2017-04-24 16:22:53","price":850,"id":7,"scity":"呼和浩特市","info":"超市货品（饮料、牛奶等等）","saddr":"万达广场步行街万达东巷B区","elon":"110.026074","eaddr":"东河公园路六号街坊3栋10号","ecity":"包头市","timelimit":4,"lefttime":3,"elat":"40.588593","sdistrict":"新城区","eprovince":"内蒙古自治区","ctel":"15605182016","etime":"2017-04-28 18:30:00","slat":"40.842466"}]}
    );
});



//根据订单Id查看详情
app.post('/package/search', function (req, res) {
    res.json(
        {"status":"ok","message":"ok","data":[{"sprovince":"北京市","flag":0,"cname":"赵一","stime":"2017-04-16 23:45:00","remark":"服务态度很好，物品没有损坏","edistrict":"西城区","oid":"734201814991","slon":"116.417114","uid":1,"releasetime":"2017-04-14 13:24:59","price":1200,"id":1,"scity":"北京市","info":"欧式彩色玻璃花瓶（注意：易碎物品！）","saddr":"王府井大街新燕莎金街购物广场6楼MF608室","elon":"116.359166","eaddr":"车公庄大街4号1949文化创意园区3号楼西侧中心庭院","ecity":"北京市","timelimit":4,"lefttime":0,"elat":"39.936425","sdistrict":"东城区","eprovince":"北京市","ctel":"15605182010","etime":"2017-04-17 15:48:00","grade":"5.0","evaluatetime":"2017-04-18 16:05:53","slat":"39.916109"}]}
    );
});


//定时上报位置
app.post('/location/add', function (req, res) {
    res.json(
        {"status":"ok","message":"ok","data":"44"}
    );
});


//订单报价，添加竞价用户和报价
app.post('/bidding/add', function (req, res) {
    res.json(
        {"status":"ok","message":"ok","data":"6"}
    );
});

//取消报价
app.post('/bidding/remove', function (req, res) {
    res.json(
        {"status":"ok","message":"ok"}
    );
});

//判断用户是否参与该订单的竞价
app.post('/bidding/search', function (req, res) {
    res.json(
        {"status":"ok","message":"ok","data":[{"uid":1,"uname":"苏A12345","price":1100,"pid":1,"id":1}]}
    );
});

//列出用户已完成的订单
app.post('/completed/list', function (req, res) {
    res.json(
       {"status":"ok","message":"ok","data":[{"sprovince":"北京市","flag":0,"cname":"赵一","stime":"2017-04-16 23:45:00","remark":"服务态度很好，物品没有损坏","edistrict":"西城区","oid":"734201814991","slon":"116.417114","uid":1,"releasetime":"2017-04-14 13:24:59","price":1200,"id":1,"scity":"北京市","info":"欧式彩色玻璃花瓶（注意：易碎物品！）","saddr":"王府井大街新燕莎金街购物广场6楼MF608室","elon":"116.359166","eaddr":"车公庄大街4号1949文化创意园区3号楼西侧中心庭院","ecity":"北京市","timelimit":4,"lefttime":0,"elat":"39.936425","sdistrict":"东城区","eprovince":"北京市","ctel":"15605182010","etime":"2017-04-17 15:48:00","grade":"5.0","evaluatetime":"2017-04-18 16:05:53","slat":"39.916109"},{"sprovince":"天津市","flag":0,"cname":"钱二","stime":"2017-04-18 14:25:00","remark":"态度挺好，总体挺满意","edistrict":"河东区","oid":"402193681259","slon":"117.221284","uid":1,"releasetime":"2017-04-15 19:35:41","price":1000,"id":2,"scity":"天津市","info":"不锈钢餐具","saddr":"大沽北路167号天津丽思卡尔顿酒店1楼","elon":"117.260892","eaddr":"津滨大道万达广场3楼308室","ecity":"天津市","timelimit":4,"lefttime":0,"elat":"39.130593","sdistrict":"和平区","eprovince":"天津市","ctel":"15605182011","etime":"2017-04-19 09:23:00","grade":"4.5","evaluatetime":"2017-04-20 10:16:32","slat":"39.12669"}]}
    );
});


console.log("start express server\n");

